﻿namespace MtApi
{
    // https://docs.mql4.com/constants/errorswarnings/errorcodes
    public enum MtErrorCode
    {
        MtApiCustomError                    = -1,   // Error occurred in MtApi.
        NoError                             = 0,    // No error returned.
        NoResult                            = 1,    // No error returned, but the result is unknown.
        CommonError                         = 2,    // Common error.
        InvalidTradeParameters              = 3,    // Invalid trade parameters.
        ServerBusy                          = 4,    // Trade server is busy.
        OldVersion                          = 5,    // Old version of the client terminal.
        NoConnection                        = 6,    // No connection with trade server.
        NotEnoughRights                     = 7,    // Not enough rights.
        TooFrequentRequests                 = 8,    // Too frequent requests.
        MalfunctionalTrade                  = 9,    // Malfunctional trade operation.
        AccountDisabled                     = 64,   // Account disabled.
        InvalidAccount                      = 65,    // Invalid account.
        TradeTimeout                        = 128,    // Trade timeout.
        InvalidPrice                        = 129,    // Invalid price.
        InvalidStops                        = 130,    // Invalid stops.
        InvalidTradeVolume                  = 131,    // Invalid trade volume.
        MarketClosed                        = 132,    // Market is closed.
        TradeDisabled                       = 133,    // Trade is disabled.
        NotEnoughMoney                      = 134,    // Not enough money.
        PriceChanged                        = 135,    // Price changed.
        OffQuotes                           = 136,    // Off quotes.
        BrokerBusy                          = 137,    // Broker is busy.
        Requote                             = 138,    // Requote.
        OrderLocked                         = 139,    // Order is locked.
        LongPositionsOnlyAllowed            = 140,    // Long positions only allowed.
        TooManyRequests                     = 141,    // Too many requests.
        TradeModifyDenied                   = 145,    // Modification denied because an order is too close to market.
        TradeContextBusy                    = 146,    // Trade context is busy.
        TradeExpirationDenied               = 147,    // Expirations are denied by broker.
        TradeTooManyOrders                  = 148,    // The amount of opened and pending orders has reached the limit set by a broker.

        NoMqlerror                          = 4000,    // No error.
        WrongFunctionPointer                = 4001,    // Wrong function pointer.
        ArrayIndexOutOfRange                = 4002,    // Array index is out of range.
        NoMemoryForFunctionCallStack        = 4003,    // No memory for function call stack.
        RecursiveStackOverflow              = 4004,    // Recursive stack overflow.
        NotEnoughStackForParameter          = 4005,    // Not enough stack for parameter.
        NoMemoryForParameterString          = 4006,    // No memory for parameter string.
        NoMemoryForTempString               = 4007,    // No memory for temp string.
        NotInitializedString                = 4008,    // Not initialized string.
        NotInitializedArraystring           = 4009,    // Not initialized string in an array.
        NoMemoryForArraystring              = 4010,    // No memory for an array string.
        TooLongString                       = 4011,    // Too long string.
        RemainderFromZeroDivide             = 4012,    // Remainder from zero divide.
        ZeroDivide                          = 4013,    // Zero divide.
        UnknownCommand                      = 4014,    // Unknown command.
        WrongJump                           = 4015,    // Wrong jump.
        NotInitializedArray                 = 4016,    // Not initialized array.
        DllCallsNotAllowed                  = 4017,    // DLL calls are not allowed.
        CannotLoadLibrary                   = 4018,    // Cannot load library.
        CannotCallFunction                  = 4019,    // Cannot call function.
        ExternalExpertCallsNotAllowed       = 4020,    // EA function calls are not allowed.
        NotEnoughMemoryForReturnedString    = 4021,    // Not enough memory for a string returned from a function.
        SystemBusy                          = 4022,    // System is busy.
        InvalidFunctionParametersCount      = 4050,    // Invalid function parameters count.
        InvalidFunctionParameterValue       = 4051,    // Invalid function parameter value.
        StringFunctionInternalError         = 4052,    // String function internal error.
        SomeArrayError                      = 4053,    // Some array error.
        IncorrectSeriesArrayUsing           = 4054,    // Incorrect series array using.
        CustomIndicatorError                = 4055,    // Custom indicator error.
        IncompatibleArrays                  = 4056,    // Arrays are incompatible.
        GlobalVariablesProcessingError      = 4057,    // Global variables processing error.
        GlobalVariableNotFound              = 4058,    // Global variable not found.
        FunctionNotAllowedInTestingMode     = 4059,    // Function is not allowed in testing mode.
        FunctionNotConfirmed                = 4060,    // Function is not confirmed.
        SendMailError                       = 4061,    // Mail sending error.
        StringParameterExpected             = 4062,    // String parameter expected.
        IntegerParameterExpected            = 4063,    // Integer parameter expected.
        DoubleParameterExpected             = 4064,    // Double parameter expected.
        ArrayAsParameterExpected            = 4065,    // Array as parameter expected.
        HistoryWillUpdated                  = 4066,    // Requested history data in updating state.
        TradeError                            = 4067, // Some error in trade operation execution.
        EndOfFile                           = 4099,    // End of a file.
        SomeFileError                       = 4100,    // Some file error.
        WrongFileName                       = 4101,    // Wrong file name.
        TooManyOpenedFiles                  = 4102,    // Too many opened files.
        CannotOpenFile                      = 4103,    // Cannot open file.
        IncompatibleAccessToFile            = 4104,    // Incompatible access to a file.
        NoOrderSelected                     = 4105,    // No order selected.
        UnknownSymbol                       = 4106,    // Unknown symbol.
        InvalidPriceParam                   = 4107,    // Invalid price.
        InvalidTicket                       = 4108,    // Invalid ticket.
        TradeNotAllowed                     = 4109,    // Trade is not allowed.
        LongsNotAllowed                     = 4110,    // Longs are not allowed.
        ShortsNotAllowed                    = 4111,    // Shorts are not allowed.
        ObjectAlreadyExists                 = 4200,    // Object already exists.
        UnknownObjectProperty               = 4201,    // Unknown object property.
        ObjectDoesNotExist                  = 4202,    // Object does not exist.
        UnknownObjectType                   = 4203,    // Unknown object type.
        NoObjectName                        = 4204,    // No object name.
        ObjectCoordinatesError              = 4205,    // Object coordinates error.
        NoSpecifiedSubwindow                = 4206,    // No specified subwindow.
        SomeObjectError                     = 4207    // Some error in object operation.
    }
}